<template>
    <div id="box">
        <nav>
            <Navbar>
                <span  slot="left" @click="back"><img src="static/icons/back.png" id="back"></span>
                <span slot="center" class="nav-size">{{userInfo.name}}</span>
                <span slot="right" @click="logout">退出</span>
            </Navbar>
        </nav>
        <img id="bg" src="/static/img/u.jpg">
        <div id="pic-bottom">
            <div class="item">
                <img src="/static/pic/1.png" alt="">
                <p>全部订单</p>
            </div>
            <div class="item">
                <img src="/static/pic/2.png" alt="">
                <p>旅游订单</p>
            </div>
            <div class="item">
                <img src="/static/pic/3.png" alt="">
                <p>机票订单</p>
            </div>
            <div class="item">
                <img src="/static/pic/4.png" alt="">
                <p>景点门票</p>
            </div>
        </div>
        <div class="content-box">
            <div class="left">
                <img src="/static/pic/bao.png">
                <div id="left-l">
                    <p>旅游通宝</p>
                    <p>0通宝</p>
                </div>
            </div>
            <div class="left right">
                <img src="/static/pic/p.png">
                <div id="left-l">
                    <p>抵用券</p>
                    <p>0张可用</p>
                </div>
            </div>
        </div>
        <p class="last">
            <img src="static/icons/account.png" alt="">
            <span class="color">我的余额</span>
        </p>
        <p class="last">
            <img src="static/icons/account.png" alt="">
            <span>积分兑换</span>
        </p>
        <p class="last">
            <img src="static/icons/account.png" alt="">
            <span>兑换记录</span>
        </p>
        <p class="last">
            <img src="static/icons/account.png" alt="">
            <span>完善资料</span>
        </p>
        <p class="last">
            <img src="static/icons/psw.png" alt="">
            <span>修改密码</span>
        </p>



    </div>
</template>

<script>
import Navbar from '../components/Navbar.vue';
import {mapState} from "vuex"
export default {
    components:{
        Navbar
    },
    computed:{
        ...mapState([
            "userInfo"
        ])
    },
    methods:{
        back(){
            history.back();
        },
        logout(){
            this.$store.dispatch("logoutReuqest")
            .then(()=>{
                this.$router.push({path:'/'})
            })
        },
        
    },
    mounted:function(){
        this.$store.dispatch("requestIslogin")
    }
}
</script>

<style lang='css' scoped>
    #box{
        background-color: #f4f4f4
    }
    #back{
        width: 30px;
        height: 30px;
        margin-top: 12px;
    }
    nav{
        /*background-color: red;*/
        position: fixed;
        top: 0;
        left: 0;
    }
    #bg{
        width: 100vw;
        height: 195px;
    }
    p{
        margin: 0;
    }
    #pic-bottom{
        display: flex;
        justify-content: space-around;
        background-color: #fff;
        padding-top: 12px;
    }
    #pic-bottom p{
        color: #9e9e9e;
        font-size: 14px;
    }
    #pic-bottom img{
        /*height: 42px;*/
        width: 42px;
    }
    .item{
        /*border: 1px  solid red;*/
        width: 25%;
        text-align: center;
    }
    .content-box{
        display: flex;
        justify-content: space-between;
        background-color: #fff;
        padding: 15px;
        margin-top: 5px;
        width: 100vw;
        border-bottom: 1px solid #f7f7f7;
    }
    .left{
        display: flex;
        width: 50%;
        /*border: 1px  solid red;*/
        /*text-align: center;*/
    }
    .left img{
        width: 47px;
    }
    .left p:nth-of-type(1){
        color: #2f2f2f;
    }
    .left p:nth-of-type(2){
        font-size:14px;
        color:  #fe7467;
    }
    .right{
        padding-left: 20px;
        /*border: 1px  solid red;*/
    }
    .last{
        display: block;
        background-color: #fff;
        height: 52px;
        line-height: 52px;
        padding-left: 10px;
        border-bottom: 1px solid #f7f7f7;
    }
    .last>img{
        width: 25px;
         /*border: 1px  solid red;*/
         position: relative;
         top: 7px;
    }
    .last span{
        /*border: 1px  solid red;*/
        color: #212121;
    
    }
    .color{
        color: #ff787f!important;
    }
</style>